package com.chinasoft.goodsManager.servlet;

import com.chinasoft.goodsManager.domain.Journal;
import com.chinasoft.goodsManager.server.GoodsService;
import com.chinasoft.goodsManager.server.impl.GoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/journal")
public class JournalServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        GoodsServiceImpl goodsService = new GoodsServiceImpl();

        List<Journal> list = goodsService.List();

        request.setAttribute("list",list);

        request.getRequestDispatcher("/journal.html").forward(request,response);



    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
